%func:@使用Dipole计算条形磁铁时的被积函数
%inpt:@(a ,b, c ):条形磁铁参数
%     @(xd,yd,zd):被计算的位置
%oupt:@B = [Bx;By;Bz]
%note:
%date:2021-07-05 by xiyin,li in Hust;
%@Copyright 2021 Xiyin,li.
function B = PMDipSqu(a,b,c,position)
xd = position(1);
yd = position(2);
zd = position(3);
Br = 1.465;
V = a*b*c;
nu0 = 4*pi*10^(-7);
M = [0;0;1]*(Br*V)/nu0;
r = [xd;yd;zd];
D = norm(r);
B = (nu0/(4*pi*D^3))*((3*r*r'/(D^2))-eye(3))*M;
end
